import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate"; 

Vue.use(Vuex)

export default new Vuex.Store({
  plugins: [
    createPersistedState({ storage: window.sessionStorage }) //配置为sessionStorage，如果不传入对象就是默认
  ],
  state: {
    userdata: null,
    newmessage:null
  },
  mutations: {
    setnewmessage(state, data){
      state.newmessage=data
    },
    removenewmessage(state, data){
      state.newmessage=null
    },


    setuserdata(state, data) {
      state.userdata = data
    },
    removeuserdata(state){
      state.userdata = null
    }
  },
  actions: {
  },
  modules: {
  }
})
